package com.github.chain.admin.client;

import com.github.chain.admin.common.domain.Menu;
import com.github.chain.admin.common.domain.Role;
import com.github.chain.admin.common.domain.RoleMenu;
import com.github.chain.admin.common.domain.User;
import com.github.framework.core.page.DataPage;
import com.github.chain.admin.common.request.RoleRequest;
import com.github.framework.core.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

@FeignClient(value = "admin-server")
@RestController
public interface RoleServiceClient {

    @GetMapping("/findRoleByUserId/{userId}")
    Result<Boolean> findRoleByUserId(@PathVariable("userId") Long userId);

    @GetMapping("/findRolePermissionsByUserId/{userId}")
    Result<Set<Role>> findRolePermissionsByUserId(@PathVariable("userId") Long userId);

    @GetMapping("/findRoleByPage")
    Result<DataPage<Role>> findRoleByPage(@RequestBody RoleRequest request);

    @GetMapping("/findRoleById/{id}")
    Result<Role> findRoleById(@PathVariable("id") Long id);

    @PostMapping("/updateRole")
    Result<Integer> updateRole(@RequestBody RoleRequest roleRequest);

    @GetMapping("/deleteRoleById/{id}")
    Result<Integer> deleteRoleById(@PathVariable("id") Long id);

    @PostMapping("/deleteRoleListById")
    Result deleteRoleListById(@RequestBody List<Long> list);

    @PostMapping("/saveRole")
    Result saveRole(@RequestBody RoleRequest roleRequest);

    @PostMapping("/authPermissions")
    Result authPermissions(@RequestBody RoleMenu roleMenu);

    @GetMapping("/findUserByRoleId/{id}")
    Result<List<User>> findUserByRoleId(@PathVariable("id") Long id);

    @PostMapping("/enableRoleStatus")
    Result enableRoleStatus(@RequestBody List<Long> ids);

    @PostMapping("/disableRoleStatus")
    Result disableRoleStatus(@RequestBody List<Long> ids);
}
